package com.coocaa.x.service.liteservice;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.coocaa.x.framework.app.BootUpRunnable;
import com.coocaa.x.framework.app.CoocaaApplication;
import com.coocaa.x.framework.utils.LogUtils;

/**
 * Created by lu on 15-7-8.
 */
public class BootUpReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(final Context context, final Intent intent) {
        CoocaaApplication.post(new Runnable() {
            @Override
            public void run() {
                LogUtils.d("entry", "BootUpReceiver Action:" + intent.getAction());
                if (intent.getAction().equals(BootUpRunnable.BOOT_COMPLETED_ACTION) || intent.getAction().equals(BootUpRunnable.QUICK_RESUME_ACTION)) {
                    Intent i = new Intent("com.coocaa.x.service.liteentry");
                    i.setPackage(context.getPackageName());
                    i.putExtra("action", intent.getAction());
                    context.startService(i);
                }
            }
        });
    }
}
